#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    QPixmap pixmap(":lt.jpg");
    pixmap = pixmap.scaled(64, 64);

    QCursor cursor(pixmap);
    this->setCursor(cursor);

    ui->pushButton_reduce->setToolTip("这是一个减法");
    ui->pushButton_reduce->setToolTipDuration(5);

}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_add_clicked()
{
    float opacity = this->windowOpacity();
    if(opacity >= 1.0)
    {
        return;
    }
    opacity += 0.1;
    this->setWindowOpacity(opacity);
}

void Widget::on_pushButton_reduce_clicked()
{
    float opacity = this->windowOpacity();
    if(opacity <= 0.101)
    {
        return;
    }
    opacity -= 0.1;
    this->setWindowOpacity(opacity);
}
